<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>用户管理页面</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="../../js/jquery-3.1.1.min.js"></script>
<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="vet">
	{{# if(d.isvas=='未审核'){ }}
		<a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="vet">审核</a>
	{{# } else if(d.isvas=='已审核'){}}
		<a class="layui-btn layui-btn-sm layui-btn-disabled">已审核</a>
	{{# } }}
</script>
<script type="text/html" id="imgTpl">
    <img src="../../{{ d.manRemark }}" style="width:40px;">
</script>

<link rel="stylesheet" href="../../layui/css/layui.css" media="all">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/lobby/UserList.css" media="all">
<script src="../../js/jquery-3.1.1.min.js" charset="utf-8"></script>
<script src="../../layui/layui.js" charset="utf-8"></script>
<script src="../../js/Verification.js"></script>
<script type="text/javascript" src="../../js/lobby/UserList.js"></script>
<script src="../../js/base.js"></script>

<style type="text/css">

.invisible {
  height: .5rem;
  top: .7rem;
}
.visible {
  height: .8rem;
  top: .55rem;
}
</style>
</head>
<body>
	<div class="demoTable">
	<input type="hidden" name="page" id="page">
	<input type="hidden" name="limit" id="limit">
		用户账号：
		<div class="layui-inline">
			<input class="layui-input" id="name" name="manUser">
		</div>
		手机号：
		<div class="layui-inline">
			<input class="layui-input" id="phone"  name="manPhone" >
		</div>
	<button class="layui-btn" id="query" >搜索</button>
	<button class="layui-btn layui-btn-primary" onclick="add();">添加</button>
	</div>
	<table id="showUser" class="layui-table"
		lay-data="{width: 990,heigth: 'full-500',cellMinWidth: 80,url:'../../drugManager/findAll.action', page:true, id:'idTest' }"
		lay-filter="demo" >
		<thead>
			<tr>
				<th lay-data="{field:'manUser', width:90, align:'center'}">用户名</th>
				<th lay-data="{field:'manRemark', width:100, align:'center',templet:'#imgTpl'}">头像</th>
				<th lay-data="{field:'manPhone', width:90, align:'center'}">手机号</th>
				<th lay-data="{field:'companyName', width:200, align:'center'}">公司名称</th>
				<th lay-data="{field:'isvas', width:150, align:'center'}">审核状态</th>
				<th lay-data="{field:'optimes', width:100, align:'center'}">操作时间</th>
				<th lay-data="{field:'oper', width:90, align:'center'}">操作人</th>
				<th lay-data="{fixed:'right', width:90, align:'center', toolbar: '#vet'}">审核</th>
				<th lay-data="{fixed:'right', width:120, align:'center', toolbar: '#barDemo'}">操作</th>
			</tr>
		</thead>
	</table>
	<div id="addReload">
 		<div id="addOperation">
		 	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			  <legend>用户增加列表</legend>
			</fieldset>
			<form  class="layui-form" action="../../drugManager/addOrUpdate.action" onsubmit="return verify()" method="post" >
			  <input type="hidden" id="addRoleIds" name="roleIds">
			  <div class="layui-form-item">
			      <label class="layui-form-label">选择管理公司</label>
			      <div class="layui-input-block" style="width:280px;">
			        <select name="filId" id="filIds" lay-verify="required" lay-search="" >
			          
			        </select>
			      </div>
		      </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">用户名</label>
			    <div class="layui-input-block">
					<input type="text" name="manUser" id="manUsers"  lay-verify="required" maxlength="20" placeholder="请输入名称" autocomplete="off" class="layui-input" style="width:280px;">
			    	<span id="falseName" class="errorMess"></span>
			    </div>
			  </div>
			  <div class="layui-form-item layui-form-text">
			    <label class="layui-form-label">密码</label>
			    <div class="layui-input-block">
					<input type="password" name="manPwd"  maxlength="20" placeholder="请输入密码" autocomplete="off" class="layui-input" style="width:280px;">
			    	<span id="falsePwd" class="errorMess"></span>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">手机号</label>
			    <div class="layui-input-block">
					<input type="text" name="manPhone"  maxlength="11" placeholder="请输入手机号" autocomplete="off" class="layui-input" style="width:280px;">
			    	<span id="falsePhone" class="errorMess"></span>
			    </div>
			  </div>
			  <div class="layui-form-item">
			        <label class="layui-form-label">会员头像</label>
			        <div class="layui-input-block">
			            <button type="button" class="layui-btn" id="upload1">上传图片</button>
			            <input type="hidden" id="img_url" name="manRemark" value=""/>
			            <div class="layui-upload-list">
			                <img class="layui-upload-img" width="100px" height="80px" id="demoOne"/>
			                <p id="demoText"></p>
			            </div>
			        </div>
			  </div>
			  
			  <div class="layui-form-item">
			    <label class="layui-form-label">是否有效</label>
			    <div class="layui-input-block" style="width:200px;">
			      <select name="isva" >
			          <option value="0" >是</option>
			          <option value="1" >否</option>
			        </select>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">角色</label>
			      <div id="Addroles"  class="layui-input-block" style="width:250px; " >
			      		
				  </div>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <div class="layui-input-block">
			      <input type="submit" id="add" class="layui-btn" lay-filter="managerAdd" value="提交">
			      <button id="closeAdd" type="reset" class="layui-btn layui-btn-primary" >取消</button>
			    </div>
			  </div>
		 </form>
	 </div>
 </div>
 <div id="updateReload">
 		<div id="updateOperation">
		 	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			  <legend>用户修改列表</legend>
			</fieldset>
			<form id="updateMess" class="layui-form" action="../../drugManager/addOrUpdate.action" method="post" >
			  <input type="hidden" name="manId" id="manId" >
			  <input type="hidden" id="roleIds" name="roleIds">
			  <div class="layui-form-item">
			      <label class="layui-form-label">选择管理公司</label>
			      <div class="layui-input-block" style="width:280px;">
			        <select name="filId" id="filIdss"  lay-verify="required" disabled class="layui-disabled" lay-search="">
			          
			        </select>
			      </div>
		      </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">用户名</label>
			    <div class="layui-input-block">
			      <input type="text" name="manUser" id="manUser" lay-verify="required" disabled autocomplete="off" class="layui-input layui-disabled" style="width:280px;">
			    </div>
			  </div>
			  <div class="layui-form-item layui-form-text">
			    <label class="layui-form-label">密码</label>
			    <div class="layui-input-block">
			      <input type="password" name="manPwd" id="manPwd" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input" style="width:280px;">
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">手机号</label>
			    <div class="layui-input-block">
			      <input type="text" name="manPhone" id="manPhone" lay-verify="required" maxlength="11" placeholder="请输入手机号" autocomplete="off"  class="layui-input" style="width:280px;">
			    </div>
			  </div>
			  <div class="layui-form-item">
			        <label class="layui-form-label">用户头像</label>
			        <div class="layui-input-block">
			            <button type="button" class="layui-btn" id="uploadTwo">上传图片</button>
			            <input type="hidden" id="img_urlTwo" name="manRemark" value=""/>
			            <div class="layui-upload-list">
			                <img class="demoTow" width="100px" height="80px" id="demoTow"/>
			                <p id="demoTextTwo"></p>
			            </div>
			        </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">是否有效</label>
			    <div class="layui-input-block" style="width:200px;">
			      <select name="isva" id="isva"   >
			          <option value="0" >是</option>
			          <option value="1" >否</option>
			        </select>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">角色</label>
			      <div id="roles" class="layui-input-block" style="width:250px;" >
			      	
				  </div>
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <div class="layui-input-block">
			      <input type="submit" id="update" class="layui-btn"  value="提交">
			      <button id="closeUpdate" type="reset" class="layui-btn layui-btn-primary" >取消</button>
			    </div>
			  </div>
		 </form>
	 </div>
 </div>
 <script type="text/javascript">
 
	 function verify(){
		 var num=0;
		 var username=document.getElementById("manUsers").value;
		 if(username==''){
			 num=1;
			 layer.msg("用户名不能为空");
		 }else{
			 
			 $.ajax({
					async:false,
					type:"POST",
					url:"../../drugManager/findManagerName.action",
					data:{
						'manUser' : username
					},
					success:function(msg){
						num=msg;
						
					}
				},"json");
		 }
		
		 if(num == 0){
				return true;
			}else{
				layer.msg("用户名已存在");
				return false;
			}
	}
 </script>
</body>
</html>